//===========================[ 7 / 6 / 2011 LVI ]=============================
//				Copyright c Vitaly Lyaschenko <SkyChameleon@gmail.com>
// 								Header file
// Purpose: 
//=============================================================================
#pragma once

#include "common.h"
#include "cImage.h"

// target texture
#define glTEXTURE_1D 0x0DE0
#define glTEXTURE_2D 0x0DE1
#define glTEXTURE_3D 0x806F
#define glTEXTURE_CUBE_MAP 0x8513
// filtering texture
#define glLINEAR_MIPMAP_LINEAR 0x2703
#define glLINEAR 0x2601
// warp texture
#define glCLAMP  0x2900
#define glCLAMP_TO_EDGE 0x812F
#define glREPEAT 0x2901

class cTexture
{
	uint m_handleTex;
	uint m_targetTex;
	int m_LocationTex;

	void ReleaseTexture();

public:
	cTexture() { }
	~cTexture();

	void CreateTexture( int minFilter, int magFilter, int warp, uint target );
	void SetImage2D( cImage *pImg, bool genMIPs = false );
	void BindTexture( const int unit );
	void UnbindTexture();

	uint getHandleTexture() const { return m_handleTex; }
	uint getTargetTexture() const { return m_targetTex; }
	int  getLocationInProgram() const { return m_LocationTex; }
	void setLocationInProgram( int texLoc ) { m_LocationTex = texLoc; }
};